/* Copyright 2008 Bas van den Berg
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef COMMCHANNEL_H
#define COMMCHANNEL_H

#include <vector>
#include <string>

namespace Chronos {

class Session;

class CommChannel {
public:
	CommChannel(const std::string& name_, const char* color_, bool permanent_ = true);
	void addMember(Session& player);
	void removeMember(Session& player);
	void removeIfMember(Session& player);

    bool isEmpty() const;
    bool isPermanent() const;
	void write(Session& session, const std::string& msg);
	const std::string& getName() const;
    const std::string getFullName() const;
    void writeName(Session& session) const;
    void showMembers(Session& session) const;
private:
	void broadcast(const std::string& text);

	typedef std::vector<Session*> Members;
	typedef Members::iterator MembersIter;
	typedef Members::const_iterator MembersConstIter;
	Members members;

	const std::string name;
	const std::string color;
    bool permanent;
};

}

#endif

